package ar.edu.unlp.info.tesis.database.service;

import java.util.List;

import ar.edu.unlp.info.tesis.domain.Context;
import ar.edu.unlp.info.tesis.domain.Statement;

public class ContextService extends GenericService
{

	public ContextService()
	{
		this.setClazz(Context.class);
	}
	/**
	 * Se agrega al contexto de stamement un substament.
	 * 
	 * 
	 * @param idStatement
	 * @param subStatement
	 */
	public void addExtension(long idStatement, Statement subStatement)
	{
		StatementService ss = new StatementService();
		Statement statement = (Statement) ss.getById(idStatement);
		statement.getContext().getExtensions().add(subStatement);
		ss.update(statement);
	}


	public List<Statement> getExtensions(long idStatement)
	{
		Statement statement = (Statement) new StatementService().getById(idStatement);
		List<Statement> statementsRelated =statement.getContext().getExtensions();
		return statementsRelated;		
	}
}
